using System;
using System.Collections.Specialized;
using System.Web.Security;

namespace Be.Timvw.Framework.Web.Security
{
    public class MockMembershipProviderWrapper : MembershipProvider
    {
        private static IMembershipProvider s_MembershipProvider;
        private readonly IMembershipProvider membershipProvider;

        public MockMembershipProviderWrapper()
        {
            this.membershipProvider = s_MembershipProvider;
        }

        public static IMembershipProvider MembershipProvider
        {
            get { return s_MembershipProvider; }
            set { s_MembershipProvider = value; }
        }

        public override bool EnablePasswordRetrieval
        {
            get { return this.membershipProvider.EnablePasswordRetrieval; }
        }

        public override bool EnablePasswordReset
        {
            get { return this.membershipProvider.EnablePasswordReset; }
        }

        public override bool RequiresQuestionAndAnswer
        {
            get { return this.membershipProvider.RequiresQuestionAndAnswer; }
        }

        public override string ApplicationName
        {
            get { return this.membershipProvider.ApplicationName; }
            set { this.membershipProvider.ApplicationName = value; }
        }

        public override int MaxInvalidPasswordAttempts
        {
            get { return this.membershipProvider.MaxInvalidPasswordAttempts; }
        }

        public override int PasswordAttemptWindow
        {
            get { return this.membershipProvider.PasswordAttemptWindow; }
        }

        public override bool RequiresUniqueEmail
        {
            get { return this.membershipProvider.RequiresUniqueEmail; }
        }

        public override MembershipPasswordFormat PasswordFormat
        {
            get { return this.membershipProvider.PasswordFormat; }
        }

        public override int MinRequiredPasswordLength
        {
            get { return this.membershipProvider.MinRequiredPasswordLength; }
        }

        public override int MinRequiredNonAlphanumericCharacters
        {
            get { return this.membershipProvider.MinRequiredNonAlphanumericCharacters; }
        }

        public override string PasswordStrengthRegularExpression
        {
            get { return this.membershipProvider.PasswordStrengthRegularExpression; }
        }

        public override void Initialize(string name, NameValueCollection config)
        {
            this.membershipProvider.Initialize(name, config);
        }

        public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, Object providerUserKey, out MembershipCreateStatus status)
        {
            return this.membershipProvider.CreateUser(username, password, email, passwordQuestion, passwordAnswer, isApproved, providerUserKey, out status);
        }

        public override bool ChangePasswordQuestionAndAnswer(string username, string password, string newPasswordQuestion, string newPasswordAnswer)
        {
            return this.membershipProvider.ChangePasswordQuestionAndAnswer(username, password, newPasswordQuestion, newPasswordAnswer);
        }

        public override string GetPassword(string username, string answer)
        {
            return this.membershipProvider.GetPassword(username, answer);
        }

        public override bool ChangePassword(string username, string oldPassword, string newPassword)
        {
            return this.membershipProvider.ChangePassword(username, oldPassword, newPassword);
        }

        public override string ResetPassword(string username, string answer)
        {
            return this.membershipProvider.ResetPassword(username, answer);
        }

        public override void UpdateUser(MembershipUser user)
        {
            this.membershipProvider.UpdateUser(user);
        }

        public override bool ValidateUser(string username, string password)
        {
            return this.membershipProvider.ValidateUser(username, password);
        }

        public override bool UnlockUser(string userName)
        {
            return this.membershipProvider.UnlockUser(userName);
        }

        public override MembershipUser GetUser(Object providerUserKey, bool userIsOnline)
        {
            return this.membershipProvider.GetUser(providerUserKey, userIsOnline);
        }

        public override MembershipUser GetUser(string username, bool userIsOnline)
        {
            return this.membershipProvider.GetUser(username, userIsOnline);
        }

        public override string GetUserNameByEmail(string email)
        {
            return this.membershipProvider.GetUserNameByEmail(email);
        }

        public override bool DeleteUser(string username, bool deleteAllRelatedData)
        {
            return this.membershipProvider.DeleteUser(username, deleteAllRelatedData);
        }

        public override MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out Int32 totalRecords)
        {
            return this.membershipProvider.GetAllUsers(pageIndex, pageSize, out totalRecords);
        }

        public override int GetNumberOfUsersOnline()
        {
            return this.membershipProvider.GetNumberOfUsersOnline();
        }

        public override MembershipUserCollection FindUsersByName(string usernameToMatch, int pageIndex, int pageSize, out Int32 totalRecords)
        {
            return this.membershipProvider.FindUsersByName(usernameToMatch, pageIndex, pageSize, out totalRecords);
        }

        public override MembershipUserCollection FindUsersByEmail(string emailToMatch, int pageIndex, int pageSize, out Int32 totalRecords)
        {
            return this.membershipProvider.FindUsersByEmail(emailToMatch, pageIndex, pageSize, out totalRecords);
        }
    }
}